package com.ruoyi.safe.controller.web;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.safe.domain.BizSafeBillno;
import com.ruoyi.safe.service.IBizSafeBillnoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 安全罚款台账编号定义Controller
 * 
 * @author ruoyi
 * @date 2023-11-15
 */
@RestController
@RequestMapping("/billno/billno")
public class BizSafeBillnoController extends BaseController
{
    @Autowired
    private IBizSafeBillnoService bizSafeBillnoService;

    /**
     * 查询安全罚款台账编号定义列表
     */
    @PreAuthorize("@ss.hasPermi('billno:billno:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizSafeBillno bizSafeBillno)
    {
        startPage();
        List<BizSafeBillno> list = bizSafeBillnoService.selectBizSafeBillnoList(bizSafeBillno);
        return getDataTable(list);
    }

    /**
     * 导出安全罚款台账编号定义列表
     */
    @PreAuthorize("@ss.hasPermi('billno:billno:export')")
    @Log(title = "安全罚款台账编号定义", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizSafeBillno bizSafeBillno)
    {
        List<BizSafeBillno> list = bizSafeBillnoService.selectBizSafeBillnoList(bizSafeBillno);
        ExcelUtil<BizSafeBillno> util = new ExcelUtil<BizSafeBillno>(BizSafeBillno.class);
        util.exportExcel(response, list, "安全罚款台账编号定义数据");
    }

    /**
     * 获取安全罚款台账编号定义详细信息
     */
    @PreAuthorize("@ss.hasPermi('billno:billno:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bizSafeBillnoService.selectBizSafeBillnoById(id));
    }

    /**
     * 新增安全罚款台账编号定义
     */
    @PreAuthorize("@ss.hasPermi('billno:billno:add')")
    @Log(title = "安全罚款台账编号定义", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizSafeBillno bizSafeBillno)
    {
        return toAjax(bizSafeBillnoService.insertBizSafeBillno(bizSafeBillno));
    }

    /**
     * 修改安全罚款台账编号定义
     */
    @PreAuthorize("@ss.hasPermi('billno:billno:edit')")
    @Log(title = "安全罚款台账编号定义", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizSafeBillno bizSafeBillno)
    {
        return toAjax(bizSafeBillnoService.updateBizSafeBillno(bizSafeBillno));
    }

    /**
     * 删除安全罚款台账编号定义
     */
    @PreAuthorize("@ss.hasPermi('billno:billno:remove')")
    @Log(title = "安全罚款台账编号定义", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizSafeBillnoService.deleteBizSafeBillnoByIds(ids));
    }
}
